/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86131
 * Date: 2023-11-07
 * Time: 12:54
 */
class PetDog{
   public String name;
   public String color;

   public void barks(){
       System.out.println(name+"汪汪汪~~~");
   }
   public void wag(){
       System.out.println(name+"摇尾巴~~~");
   }

}


class MyValue{
    public int val;
}


public class test{
    public static void swap(MyValue val1,MyValue val2){
        int tmp = val1.val;
        val1.val = val2.val;
        val2.val = tmp;

    }
    public static void main(String[] args) {
        MyValue value1 = new MyValue();
        value1.val = 10;

        MyValue value2 = new MyValue();
        value2.val = 20;
        System.out.println("交换前:"+value1.val);
        System.out.println("交换前:"+value2.val);
        System.out.println();
        swap(value1,value2);
        System.out.println("交换后:"+value1.val);
        System.out.println("交换后:"+value2.val);

    }
    public static void main1(String[] args) {
        PetDog dogh= new PetDog();  //实例化对象
        dogh.name = "阿黄";
        dogh.color ="黑色";
        dogh.barks();
        dogh.wag();
        System.out.println("姓名: "+dogh.name);
        System.out.println("颜色: "+dogh.color);
    }
}